//
//  HTSettingView.swift
//  MagaCore
//
//  Created by 谢 on 2024/8/22.
//

import SwiftUI
import PKHUD

struct HTSettingView: View {
    var body: some View {
        HTNavigationBar {
            ScrollView(showsIndicators: false) {
                VStack(spacing: 0) {
                    NavigationLink(destination: HTFeedbackView()) {
                        HStack(spacing: 0){
                            Text("Feedback")
                                .font(.system(size: 14, weight: .regular))
                                .foregroundStyle(Color(hex: "#393939"))
                                .padding(.leading, 14)
                            
                            Spacer()
                        }
                        .frame(height: 56)
                        .padding(.top, 24)
                    }
                    
                    Rectangle().foregroundStyle(.black.opacity(0.04))
                        .frame(height: 1)
                        .padding(.leading, 14)
                    
                    NavigationLink(destination: HTAboutView()) {
                        HStack(spacing: 0){
                            Text("About")
                                .font(.system(size: 14, weight: .regular))
                                .foregroundStyle(Color(hex: "#393939"))
                                .padding(.leading, 14)
                            
                            Spacer()
                        }
                        .frame(height: 56)
                    }
                    
                    Rectangle().foregroundStyle(.black.opacity(0.04))
                        .frame(height: 1)
                        .padding(.leading, 14)
                    
                    HStack(spacing: 0){
                        Text("Clear Cache")
                            .font(.system(size: 14, weight: .regular))
                            .foregroundStyle(Color(hex: "#393939"))
                            .padding(.leading, 14)
                        
                        Spacer()
                    }
                    .frame(height: 56)
                    .background(content: {
                        Color(hex: "#F8F8F8")
                    })
                    .onTapGesture {
                        HUD.flash(.label("Clear Success"), delay: 1.0)
                    }
                    
                    Rectangle().foregroundStyle(.black.opacity(0.04))
                        .frame(height: 1)
                        .padding(.leading, 14)
                }
            }
        }
        .ht_title(title: "Setting")
        .ht_maxWidth(leading: 80, trailing: 80)
        .toolbar(.hidden,for: .tabBar)
        .background(content: {
            Color(hex: "#F8F8F8")
        })
    }
}

#Preview {
    HTSettingView()
}
